<%@page contentType="text/html" pageEncoding="UTF-8" import="java.io.*, java.sql.*, javax.sql.*"%>
<%
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pragma", "no-cache");
    response.setDateHeader("Expires", -1);
    String gotoTab = (String) session.getAttribute("gotoTab");
    Connection con = com.elookinto.wordlist.Util.getCon();
    String uid = (String) session.getAttribute("uid");
    if (uid == null) {
        return;
    }
    PreparedStatement st = con.prepareStatement("Select distinct listname  from wordlist where uid=? order by listname");
    st.setString(1, uid);
    response.setHeader("Access-Control-Allow-Origin", "*");
    String server = request.getServerName();
%>
<br/>
<div style="margin-top:14px;">
    <p style="font-weight:bold;color:brown!important;margin-top:0px;display:inline">
        (<label for='gotoTab' style="display: inline;color:lightblue!important"> To WL Tab?  </label> 
        <span style="display:inline;"> <input  <%= "true".equals(gotoTab) ? "checked" : ""%> style="display: inline" id="gotoTab" type="checkbox" />    </span>):
    </p>
    <Select  style="display: inline" onchange='
        var listName = this.options[this.selectedIndex].text;
        var word = document.getElementById("gdx-bubble-query");
        if (word != null)
        {
            word = word.innerHTML.replace(/\W+/g,"");
            
        } else { return; }
    
        var gotoTab = document.getElementById("gotoTab").checked;
        window.open("http://www.elookinto.com/wordlist/index.jsp?listName=" + listName + "&word="+ word + "&gotoTab=" + gotoTab  , "elookinto"); 
       
        if (!document.getElementById("gotoTab").checked) {
            window.focus();
        }
         document.getElementById("gdx-bubble-main").style.display="none";
             '> 
        <option   style="color:brown"> --------- </option>
        <option   style="color:brown"> Recent </option>
        <%
            st = con.prepareStatement("Select distinct listname  from wordlist where uid=? order by listname");
            st.setString(1, uid);

            ResultSet rs = st.executeQuery();
            while (rs.next()) {
                String mylistName = rs.getString("listname");
                if (mylistName.equals("Recent")) {
                    continue;
                }
                out.println("<option class='edit'><a href='#" + mylistName + "'>" + mylistName + "</option>");
            }
        %>

    </select><span style="font-weight: bold;color:darkorange"> + My List</span>
</div>
<%
    rs.close();
    st.close();
    con.close();
%>

